<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets">
<ui:composition template="/template/_template.xhtml">
	<ui:define name="conteudo">
		<h:form>
			<h:messages />
			<h:inputHidden value="#{alunoBean.aluno.idAluno}" />
			<fieldset>
				<LEGEND>Cadastro de Aluno</LEGEND>
				<h:panelGrid id="painelAluno" columns="2">
					<h:outputLabel id="lblMatricula" for="lblMatricula"
						value="Matricula:" />
					<h:inputText id="txtMatricula" label="lblMatricila"
						value="#{alunoBean.aluno.matricula}" required="true"
						maxlength="100" requiredMessage="Informe a Matricula"
						validatorMessage="A matricula ultrapassou 100 caracteres"
						styleClass="txtMatricula">
						<f:validateLength maximum="100" />
					</h:inputText>
					<h:outputLabel id="lblNome" for="lblNome" value="Nome:" />
					<h:inputText id="txtNome" label="lblNome"
						value="#{alunoBean.aluno.nome}" maxlength="100" required="true"
						requiredMessage="Informe o Nome"
						validatorMessage="O nome ultrapassou 100 caracteres"
						styleClass="txtNome">
						<f:validateLength maximum="100" />
					</h:inputText>
					<h:outputLabel id="lblSexo" for="lblSexo" value="Sexo:" />
					<h:selectOneRadio value="#{alunoBean.sexo}" required="true"
						requiredMessage="Selecione o Sexo">
						<f:selectItems value="#{alunoBean.constantes.sexos}" var="s"
							itemLabel="#{s.descricao}" itemValue="#{s.tipo}" />
					</h:selectOneRadio>
					<h:outputLabel id="lblDataNascimento" for="lblDataNascimento"
						value="Data Nascimento:" />
					<h:inputText id="txtDataNascimento" label="lblDataNascimento"
						value="#{alunoBean.aluno.dataNascimento.time}" required="true"
						requiredMessage="Informe a Data de Nascimento(dd//MM/yyyy)"
						styleClass="txtDataNascimento">
						<f:convertDateTime pattern="dd/MM/yyyy"
							timeZone="America/Sao_Paulo" />
					</h:inputText>
					<h:outputLabel id="lblCPF" for="lblCPF" value="CPF:" />
					<h:inputText id="txtCPF" lable="lblCPF"
						value="#{alunoBean.aluno.cpf}" maxlength="20" required="true"
						requiredMessage="Informeo CPF"
						validatorMessage="O CPF ultrapassou 20 caracteres"
						styleClass="txtCPF">
						<f:validateLength maximum="20" />
					</h:inputText>
				</h:panelGrid>
			</fieldset>
			<br />
			<fieldset>
				<LEGEND>Orientador do Aluno</LEGEND>
				<h:panelGrid columns="2">
					<h:outputLabel id="lblOrientador" for="lblOrientador"
						value="Selecione o Orientador:" />
					<h:selectOneMenu id="orientador"
						value="#{alunoBean.idOrientadorSelecionado}"
						styleClass="slOrientador" required="true"
						requiredMessage="Escolha um Orientador">
						<f:selectItems value="#{alunoBean.orientadores}" var="orientador"
							itemLabel="#{orientador.nome}"
							itemValue="#{orientador.idOrientador}" />
					</h:selectOneMenu>
					<h:commandButton id="btnGravarOriendaor" value="Gravar Orientador"
						action="#{alunoBean.gravarOrientador}">
						<f:ajax execute="orientador" render="txtOrientdaorSelecionado" />
					</h:commandButton>
					<h:commandLink action="#{alunoBean.novoOrientador}"
						immediate="true">
						<h:graphicImage library="img" name="novo.png"></h:graphicImage>
					</h:commandLink>
					<h:outputLabel id="lblOrientadorSelecionado"
						for="lblOrientadorSelecionado" value="Orientador Selecionado:" />
					<h:outputText id="txtOrientdaorSelecionado"
						value="#{alunoBean.nomeOrientadorSelecionado}"
						style="font-family: arial;font-weight: bold;" />
				</h:panelGrid>
			</fieldset>
			<br />
			<h:panelGrid id="panelBotao" columns="3">
				<h:commandButton id="btnNovo" value="Novo" styleClass="btnNovo"
					action="#{alunoBean.novo}" immediate="true">
				</h:commandButton>
				<h:commandButton id="btnSalvar" value="Salvar"
					styleClass="btnSalvar" action="#{alunoBean.gravarAluno}" />
				<h:commandButton id="btnExcluir" value="Excluir"
					styleClass="btnExcluir" action="#{alunoBean.excluirAluno}" />
			</h:panelGrid>
		</h:form>
	</ui:define>
</ui:composition>
</html>